]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dateMenu: Do a better job at size freezing while browsing dates
authorFlorian Müllner <fmuellner@gnome.org>
Sun, 26 Feb 2017 13:37:51 +0000 (14:37 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 27 Feb 2017 20:23:48 +0000 (21:23 +0100)
In order to avoid distracting popup size changes while browsing
other dates, we freeze the size to the last size request. However
in case of more complex size negotiations - wrapping or ellipsizing
labels, scrollable elements etc. - there's a chance of stray calls
to get_preferred_width/height() that are not used for the actual
allocation. If such a call happens to be the last size request
before the layout is frozen, the saved size will be wrong. To fix
this, save the allocated size rather than the requested one.

https://bugzilla.gnome.org/show_bug.cgi?id=754031

js/ui/dateMenu.js

index 47b22a495b7a551e026ca633b8dbdc5ab288d3d1..9e49e2d9a20532ab32f942b1d5e6d0e8eba64d03 100644 (file)
@@ -279,14 +279,22 @@ const FreezableBinLayout = new Lang.Class({
 
     vfunc_get_preferred_width: function(container, forHeight) {
         if (!this._frozen || this._savedWidth.some(isNaN))
-            this._savedWidth = this.parent(container, forHeight);
+            return this.parent(container, forHeight);
         return this._savedWidth;
     },
 
     vfunc_get_preferred_height: function(container, forWidth) {
         if (!this._frozen || this._savedHeight.some(isNaN))
-            this._savedHeight = this.parent(container, forWidth);
+            return this.parent(container, forWidth);
         return this._savedHeight;
+    },
+
+    vfunc_allocate: function(container, allocation, flags) {
+        this.parent(container, allocation, flags);
+
+        let [width, height] = allocation.get_size();
+        this._savedWidth = [width, width];
+        this._savedHeight = [height, height];
     }
 });